package xyz.chaobei.video;
import java.io.File;

import it.sauronsoftware.jave.AudioAttributes;
import it.sauronsoftware.jave.Encoder;
import it.sauronsoftware.jave.EncodingAttributes;
import it.sauronsoftware.jave.VideoAttributes;
/**
 * @author <a href='mailto:maruichao52@gmail.com'>MRC</a>
 * @since 2021/3/10
 */
public class JaveTest {
    public static void main(String[] args) {
        File source = new File("d:\\VID_20210310_171717.mp4");
        File target = new File("d:\\test.mp4");
        try {
            System.out.println("begin");
            AudioAttributes audio= new AudioAttributes();
            audio.setCodec("libmp3lame");
            audio.setBitRate(new Integer(56000));
            audio.setChannels(new Integer(1));
            audio.setSamplingRate(new Integer(22050));
            VideoAttributes video=new VideoAttributes();
            video.setCodec("mpeg4");
            video.setBitRate(new Integer(800000));
            video.setFrameRate(new Integer(15));
            EncodingAttributes attr=new EncodingAttributes();
            attr.setFormat("mp4");
            attr.setAudioAttributes(audio);
            attr.setVideoAttributes(video);
            Encoder encoder=new Encoder();
            encoder.encode(source, target, attr);
            System.out.println("end");
        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}
